home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15027 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.9 KB

  1. Path: nntp.earthlink.net!usenet
  2. From: rec@elf115.elf.org (Roger E. Critchlow Jr.)
  3. Newsgroups: comp.lang.tcl,comp.lang.c,comp.os.linux.development.system
  4. Subject: Re: How do I get a (FILE *) from file descriptor?
  5. Followup-To: comp.lang.tcl
  6. Date: 16 Apr 1996 13:05:37 -0700
  7. Organization: entropy liberation front
  8. Sender: rec@elf115.elf.org
  9. Message-ID: <55ybnworxq.fsf@elf115.elf.org>
  10. References: <yvdohosur3f.fsf@i44sg1.info.uni-karlsruhe.de>
  11. NNTP-Posting-Host: elf115.elf.org
  12. In-reply-to: frick@i44sg1.informatik.uni-karlsruhe.de's message of 16 Apr 1996
  13.     17:27:18 +0200
  14. X-Newsreader: Gnus v5.1
  15.  
  16. frick@i44sg1.informatik.uni-karlsruhe.de (Arne K. Frick) writes:
  17.  
  18.    Background: A Tcl extension I use depends on using the (FILE *) form for
  19.    describing its file handles.  However, in Tcl-7.5b3 J. Ousterhout dropped
  20.    support for the UNIX-specific command 'Tcl_GetOpenFile' which would take a
  21.    Tcl handle and return the associated (FILE *).  Now, all there is is a set
  22.    of functions ultimately giving me an (int) as a file descriptor.
  23.  
  24. Relax, Tcl_GetOpenFile() is back in the final release of tcl7.5.
  25.  
  26. -- rec --
  27.  
  28.  
  29. Tcl_GetOpenFile(3)    Tcl Library Procedures   Tcl_GetOpenFile(3)
  30.  
  31. _________________________________________________________________
  32.  
  33. NAME
  34.        Tcl_GetOpenFile  -  Get a standard IO File * handle from a
  35.        channel.
  36.  
  37. SYNOPSIS
  38.        #include <tcl.h>
  39.  
  40.        int
  41.        Tcl_GetOpenFile(interp, string, write, checkUsage, filePtr)
  42.  
  43. ARGUMENTS
  44.        Tcl_Interp   *interp      (in)      Tcl  interpreter  from
  45.                                            which  file  handle is
  46.                                            to be obtained.
  47.  
  48.        char         *string      (in)      String     identifying
  49.                                            channel, such as stdin
  50.                                            or file4.
  51.  
  52.        int          write        (in)      Non-zero   means   the
  53.                                            file  will be used for
  54.                                            writing, zero means it
  55.                                            will be used for read-
  56.                                            ing.
  57.  
  58.        int          checkUsage   (in)      If non-zero,  then  an
  59.                                            error  will  be gener-
  60.                                            ated   if   the   file
  61.                                            wasn't  opened for the
  62.                                            access  indicated   by
  63.                                            write.
  64.  
  65.        ClientData   *filePtr     (out)     Points   to   word  in
  66.                                            which to store pointer
  67.                                            to  FILE structure for
  68.                                            the  file   given   by
  69.                                            string.
  70. _________________________________________________________________
  71.  
  72. DESCRIPTION
  73.        Tcl_GetOpenFile takes as argument a file identifier of the
  74.        form returned by the open command and returns at  *filePtr
  75.        a  pointer  to the FILE structure for the file.  The write
  76.        argument indicates whether the FILE pointer will  be  used
  77.        for  reading or writing.  In some cases, such as a channel
  78.        that connects to a  pipeline  of  subprocesses,  different
  79.        FILE  pointers  will  be returned for reading and writing.
  80.        Tcl_GetOpenFile normally  returns  TCL_OK.   If  an  error
  81.        occurs  in  Tcl_GetOpenFile  (e.g.  string didn't make any
  82.        sense or checkUsage was set and the file wasn't opened for
  83.        the  access specified by write) then TCL_ERROR is returned
  84.        and interp->result will contain an error message.  In  the
  85.        current  implementation  checkUsage is ignored and consis-
  86.        tency checks are always performed.
  87.  
  88. KEYWORDS
  89.        channel, file handle, permissions, pipeline, read, write
  90.  
  91. Tcl                            7.5                              2
  92.